//
//  LogInPassWordFooterView.m
//  EasyToTesco2.0
//
//  Created by 袖手旁觀 on 16/6/17.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "LogInPassWordFooterView.h"

@implementation LogInPassWordFooterView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self loadLogInPassWordViewButton];
    }
    return self;
}

- (void)loadLogInPassWordViewButton {
    UIButton *button = [[UIButton alloc] init];
    [button setBackgroundColor:DEFAULT_COLOR];
    button.layer.cornerRadius = 5;
    button.layer.masksToBounds = YES;
    button.titleLabel.font = [UIFont systemFontOfSize:15];
    [button setTitle:@"确        认" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(didClickLogInPassWordFooterViewButton:) forControlEvents:UIControlEventTouchUpInside];
    button.titleLabel.font = [UIFont systemFontOfSize:20];
    [self addSubview:button];
    self.button = button;
    
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top).with.offset(self.Height/5);
        make.height.mas_equalTo(self.Height/4 + 5);
        make.width.mas_equalTo(WIDTH- 30);
    }];
}

- (void)didClickLogInPassWordFooterViewButton:(UIButton *)button {
    if ([self.delegate respondsToSelector:@selector(LogInPassWordFooterViewButton:)]) {
        [self.delegate LogInPassWordFooterViewButton:button];
    }
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    if ([self.delegate respondsToSelector:@selector(didViewClickClearTextField)]) {
        [self.delegate didViewClickClearTextField];
    }
}

@end
